|
Poster:
|
friscokillaz |
Date:
|
March 07, 2003 02:07:18pm |
|
Forum:
|
web
|
Subject:
|
Google's Cache |
Hi. Just yesterday I checked Google's cache on a certain Web page. But today it says 'Sorry, no information for that page available.'
I think Google removed a cache (why did it have to be now?) of a page that I needed to view.
I really, really needed to view this page (which is
http://fog.ccsf.cc.ca.us/~cpersiko/cis110b/pp3.cpp.html by the way) and the WayBack Machine doesn't have it. Any suggestions?
|
Poster:
|
friscokillaz |
Date:
|
March 08, 2003 02:54:56am |
|
Forum:
|
web
|
Subject:
|
Re: Google's Cache |
Good idea, but it still didn't have that page. Anyways, just wish Google didn't have its dances on Thursdays. :(
|
Poster:
|
hkazemi |
Date:
|
March 23, 2003 07:46:08am |
|
Forum:
|
web
|
Subject:
|
Re: Google's Cache |
looks like the site is back now...
http://fog.ccsf.cc.ca.us/~cpersiko/cis110b/pp3.cpp.html
/*
pp3.cpp
Craig Persiko
Solution to CIS110B Practice Problem 3
This class is used to store a time of day, input and output it,
and add a number of minutes to it.
*/
#include
using namespace std;
class Time
{
private:
int hours;
int minutes;
// normalize the data, making sure that minutes are
// less than 60 (60 minutes = 1 hour)
// Also, subtract out any full days (25:00 should really be 1:00)
void normalize();
public:
// Default Constructor
// initialize time to 0 (midnight)
Time();
// 2-argument Constructor:
// initialize time using parameters, normalizing data if needed
Time(int hr, int min);
void setTime();
// set time based on user input, normalizing data if needed
void add(int elapsedMinutes);
// add elapsedMinutes to this object's time, normalizing data if needed
void show(bool showAMPM);
// display time on the screen, using 24-hour time if showAMPM is false,
// or 12-hour time if showAMPM is true. Display in standard h:mm format.
};
int main()
{
Time amClassTime(11, 10), pmClassTime(15, 10);
Time tuesThurClassTime(12, 10);
Time curTime;
int numMins;
cout << "currently, the variable curTime = ";
curTime.show(true);
cout << "\nCIS 110B meets on Monday and Wednesday at ";
amClassTime.show(true);
cout << "\nwhich is the same as ";
amClassTime.show(false);
cout << "\nThe class also meets at ";
pmClassTime.show(true);
cout << "\nwhich is the same as ";
pmClassTime.show(false);
cout << "\nAnd on Tuesday and Thursday at ";
tuesThurClassTime.show(true);
cout << "\nwhich is the same as ";
tuesThurClassTime.show(false);
cout << "\nWhat time is it now?";
curTime.setTime();
cout << "Enter a number: ";
cin >> numMins;
curTime.add(numMins);
cout << "In " << numMins << " minutes it will be: ";
curTime.show(true);
cout << endl;
return 0;
}
// normalize the data, making sure that minutes are
// less than 60 (60 minutes = 1 hour)
// Also, subtract out any full days (25:00 should really be 1:00)
void Time::normalize()
{
int allMinutes;
if ((hours >= 24) || (minutes >= 60))
{ // handle extra minutes or hours
allMinutes = hours * 60 + minutes;
hours = allMinutes / 60; // integer division for integer result
minutes = allMinutes % 60;
hours %= 24; // Remove any full days from our time
}
}
// Default Constructor
// initialize time to 0 (midnight)
Time::Time() : hours(0), minutes(0)
{ }
// 2-argument Constructor:
// initialize time using parameters, normalizing data if needed
Time::Time(int hr, int min) : hours(hr), minutes(min)
{
normalize();
}
//set time based on user input, normalizing data if needed
void Time::setTime()
{
cout << "\nEnter hour (in 24-hr format): ";
cin >> hours;
cout << "Enter minute: ";
cin >> minutes;
normalize();
}
// add elapsedMinutes to this object's time, normalizing data if needed
void Time::add(int elapsedMinutes)
{
minutes += elapsedMinutes;
normalize();
}
void Time::show(bool showAMPM) //display time
{
char A_or_P;
if(showAMPM)
{
if(hours > 12) // afternoon / evening
{
A_or_P = 'P';
cout << hours - 12 << ":";
}
else if (hours == 12) // noon
{
A_or_P = 'P';
cout << hours << ":";
}
else if (hours == 0) // midnight
{
A_or_P = 'A';
cout << 12 << ":";
}
else // morning
{
A_or_P = 'A';
cout << hours << ":";
}
// output minutes and AM or PM:
if(minutes < 10)
cout << "0";
cout << minutes << A_or_P << "M";
}
else // 24-hour time
{
cout << hours << ":";
if(minutes < 10)
cout << "0";
cout << minutes;
}
}
/* Sample Output:
$ a.out
currently, the variable curTime = 12:00AM
CIS 110B meets on Monday and Wednesday at 11:10AM
which is the same as 11:10
The class also meets at 3:10PM
which is the same as 15:10
And on Tuesday and Thursday at 12:10PM
which is the same as 12:10
What time is it now?
Enter hour (in 24-hr format): 9
Enter minute: 15
Enter a number: 30
In 30 minutes it will be: 9:45AM
$ a.out
currently, the variable curTime = 12:00AM
CIS 110B meets on Monday and Wednesday at 11:10AM
which is the same as 11:10
The class also meets at 3:10PM
which is the same as 15:10
And on Tuesday and Thursday at 12:10PM
which is the same as 12:10
What time is it now?
Enter hour (in 24-hr format): 23
Enter minute: 25
Enter a number: 100
In 100 minutes it will be: 1:05AM
*/
--------------------------------------------------------------------------------
syntax highlighted by Code2HTML, v. 0.9